// Copyright  2004-2008 Backplane Ltd.
//
// This file is part of DOM3XPath
//
// DOM3XPath is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3 of the License, or (at your
// option) any later version.
//
// DOM3XPath is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License
// along with DOM3XPath. If not, see <http://www.gnu.org/licenses/>.
//	
//
//   $Id$
// XPathEvaluator.h : Declaration of the CXPathEvaluator

#ifndef __XPATHEVALUATOR_H_
#define __XPATHEVALUATOR_H_

#include "resource.h"       // main symbols
//#define COUNT_EVALUATOR 1
/////////////////////////////////////////////////////////////////////////////
// CXPathEvaluator
class ATL_NO_VTABLE CXPathEvaluator : 
	public CComObjectRootEx<CComSingleThreadModel>,
	public CComCoClass<CXPathEvaluator, &CLSID_XPathEvaluator>,
	public ISupportErrorInfo,
	public IDispatchImpl<IXPathEvaluator, &IID_IXPathEvaluator, &LIBID_DOM3XPATHLib, 1, 1>
	//,public IObjectSafetyImpl<CXPathEvaluator, INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA>,
{
public:
	CXPathEvaluator()
	{
		#ifdef COUNT_EVALUATOR
			++sm_Count;	
		#endif

		InitGlobals();
	}
	virtual ~CXPathEvaluator()
	{
		#ifdef COUNT_EVALUATOR
			--sm_Count;	
		#endif
		
	}
#ifdef COUNT_EVALUATOR
	static unsigned long sm_Count;	
#endif

DECLARE_REGISTRY_RESOURCEID(IDR_XPATHEVALUATOR)

DECLARE_PROTECT_FINAL_CONSTRUCT()

BEGIN_COM_MAP(CXPathEvaluator)
	COM_INTERFACE_ENTRY(IXPathEvaluator)
	COM_INTERFACE_ENTRY(IDispatch)
//	COM_INTERFACE_ENTRY(IObjectSafety)
	COM_INTERFACE_ENTRY(ISupportErrorInfo)
END_COM_MAP()

// ISupportsErrorInfo
	STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);

// IXPathEvaluator
public:
	STDMETHOD(evaluate)(BSTR expression,IXMLDOMNode * contextNode,IXPathNSResolver*resolver,short type,IXPathResult* result,IXPathResult** retVal);
	STDMETHOD(createNSResolver)(IXMLDOMNode *nodeResolver, IXPathNSResolver **retval);
	STDMETHOD(createExpression)(BSTR expression,IXPathNSResolver * resolver,IXPathExpression** retVal);
/*
		// IObjectSafety
	STDMETHOD(SetInterfaceSafetyOptions)(REFIID riid,
			DWORD dwOptionSetMask, DWORD dwEnabledOptions)
	{
		// Set the safety options we have been asked to set.
		m_dwCurrentSafety = m_dwCurrentSafety  & ~dwEnabledOptions | dwOptionSetMask;
		return S_OK;
	} 

*/
};

#endif //__XPATHEVALUATOR_H_
